A Normal Higher-Order Termination
نویسندگان
چکیده
ion by fresh free variables is the main tool to obtain a rigid system from one which is not, therefore explaining our notation RA. Example 8.5. Consider the system R = {f(λx.h(@(H, c(x)))) → g(H)}, in which H : α→ β is the only free variable. R can be abstracted by RA = {f(X)→ g(X), h(Y )→ Y, c(z)→ z} The rule in R is abstracted by the rule f(X) → g(X) added to RA with {X 7→ λz.h(@(H, c(z)))} as abstracting substitution, requiring that λz.h(@(H, c(z)))−→RA λz.@(H, z) =η H . Considering this property as a new rule, it is abstracted in turn by the rule h(Y ) → Y in RA with {Y 7→ @(H, c(z))} as abstracting substitution, requiring that @(H, c(z))−→RA @(H, z). This new requirement is satisfied with the versatile subterm free rule c(z)→ z added to RA. LEMMA 8.6. Let R be a rigid system and s, t terms s.t. s p −→ R t for some p ∈ Pos(s). Then, s↓β −→R∪β t↓β (with s↓β −→R∪β t↓β in case p = Λ). PROOF. Since s p −→ R t, there is a rule u → v in R and a substitution γ, such that s|p = uγ and t = s[vγ]p. Since u is a rigid pattern, then (uγ) ↓β= u(γ ↓β) by Lemma 8.3, and u(γ↓β)−→R v(γ↓β)−→β v(γ↓β)↓β= (vγ)↓β . If p = Λ we are done. Otherwise, u is not an abstraction since R is a rigid system. Moreover, uγ is not an abstraction either since u is not a variable, hence s↓β= (s[uγ]p)↓β= s↓β [uγ↓β]P where P is the (possibly empty) set of positions of z in s[z]p↓β . Since (uγ)↓β −→R∪β(vγ)↓β , then s↓β [uγ↓β]P −→R∪β s↓β [vγ↓β]P −→β(s↓β [vγ↓β]P )↓β= (s[vγ])↓β . THEOREM 8.7. Let R be a normal higher-order rewrite system simulated by a rigid system S. Then −→Rβη is terminating if −→(S)η∪β is terminating. PROOF. Assume that S ∪ β is terminating modulo η. Let then be the higherorder reduction ordering −→+(S)η∪β and > be defined as s > t iff there exist u → v ∈ S and γ such that s = uγ and vγ−→S∪β t. Note that this implies that >⊆ . By Theorem 3.8, we need to show that ( , >) is a normal higher-order ordering, and for all l→ r ∈ R then l′ > r′ for some l′ =η l and r′ =η r. ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. A:34 J.-P. Jouannaud and A. Rubio Since S simulates R, then for every rule l → r ∈ R there exists u → v ∈ S and a substitution γ s.t. l′ = uγ =η l and vγ−→S∪β r′ for some r′ =η r, which implies l′ > r′ by definition of >. We now show that is normal η-compatible, which means that for all βnormal typed terms s, s′, t such that s′ =η s−→+(S)η∪β t there exists some βnormal term t′ =η t such that s−→(S)η∪β t ′. Since s is β-normal, we have that s′ =η s−→(S)η w−→ ∗ (S)η∪β t for some term w and, by definition of −→(S)η , we have s−→(S)η w, which directly implies that s −→(S)η∪β t, hence we take t as t ′. We are left showing that it is normal stable when equipped with the relation . Assume that s > t. By assumption, there is l → r and γ s.t. s = lγ−→ Λ S rγ−→S∪β t. Given an arbitrary normal substitution θ, sθ−→ Λ S rγθ−→S∪β tθ. By Lemma 8.6, sθ↓β −→S∪β rγθ↓β and rγθ↓β −→S∪β tθ↓β , therefore sθ↓β −→S∪β rγθ↓β −→S∪β tθ↓β , hence, by definition, since −→S∪β is included in −→(S)η∪β , we have sθ↓β tθ↓β . Example 8.8. Consider the rules of Example 7.4 (we could take the polymorphic version of Example 7.5 as well). By Theorem 5.19, we can apply first neutralization as an interpretation and then Theorem 8.7 to transform the resulting system to a new one whose plain termination implies that of normal rewriting with the original one. Using the same neutralization as in Example 7.4, and new variables Vτ : τ for all types τ , the rules resulting from abstraction are the following: appσ,τ (absσ,τ (F ), X) → F (X) ∃− new σ,τ (mc(o,σ)(∃σ (Z,X)), Vτ ) → Vτ Πσ,τ (Πσ,τ (X, Y )) → X Πσ,τ (Πσ,τ (X, Y )) → Y ⊥c(o,σ)→o(∃σ (Z,X)) → Z ⊥c(o,σ)→σ(∃σ (Z,X)) → X appσ,τ (∃− new ρ,σ→τ (mc(o,ρ)(T ), Vσ→τ ), X) → ∃− new ρ,τ (mc(o,ρ)(T ), appσ,τ (Vσ→τ , X)) Πσ,τ (∃− new ρ,c(σ,τ)(mc(o,ρ)(T ), Vc(σ,τ))) → ∃− new ρ,τ (mc(o,ρ)(T ),Πσ,τ (Vc(σ,τ))) Πσ,τ (∃− new ρ,c(σ,τ)(mc(o,ρ)(T ), Vc(σ,τ))) → ∃− new ρ,τ (mc(o,ρ)(T ),Πσ,τ (Vc(σ,τ))) ∃− new ρ,c(o,σ)(mc(o,ρ)(T ), Vc(o,σ))) → Vc(o,σ) ∃− new σ,τ (mc(o,σ)(∃ new ρ,c(o,σ)(mc(o,ρ)(T ), Vc(o,σ))), Vτ )→ ∃− new ρ,τ (mc(o,ρ)(T ),∃− new σ,τ (mc(o,σ)(Vc(o,σ)), Vτ )) This system can be easily proved terminating by most of the existing tools for proving termination of higher-order rewriting. Let us show in detail how the last rule of the original example is transformed into the last two given above. The original rule is ∃σ,τ (∃ρ,c(o,σ)(T, J), G)→ ∃ − ρ,τ (T, λx : o y : ρ.∃σ,τ (J(x, y), G)) and after applying the same neutralization as in Example 7.4 to both sides of the rule, we obtain ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. Normal Higher-Order Termination A:35 ∃− new σ,τ ( mc(o,σ)(∃ new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )))), @(G, ⊥c(o,σ)→o(∃ new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )))), ⊥c(o,σ)→σ(∃ new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))))))→ ∃− new ρ,τ (mc(o,ρ)(T ),∃− new σ,τ ( mc(o,σ)(@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))), @(G, ⊥c(o,σ)→o(@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))), ⊥c(o,σ)→σ(@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )))))) Then the rule is abstracted by ∃− new σ,τ (mc(o,σ)(∃ new ρ,c(o,σ)(mc(o,ρ)(T ), Vc(o,σ))), Vτ )→ ∃− new ρ,τ (mc(o,ρ)(T ),∃− new σ,τ (mc(o,σ)(Vc(o,σ)), Vτ )) with the abstracting substitution γ Vc(o,σ) 7→ @(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )) Vτ 7→ @(G,⊥c(o,σ)→o(∃ new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )))), ⊥c(o,σ)→σ(∃ new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))))) Following Definition 8.4, we need to add rules ensuring that the new righthand side instantiated by γ, namely ∃− new ρ,τ (mc(o,ρ)(T ),∃− new σ,τ (mc(o,σ)(Vc(o,σ)), Vτ ))γ, rewrites to a term η-equivalent to the original righthand side. No middle ηequivalent term is needed. Adding rules to the simulating system S so that ∃− new ρ,τ ( mc(o,ρ)(T ),∃− new σ,τ (mc(o,σ)(@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )), @(G, ⊥c(o,σ)→o( ∃− new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))) ), ⊥c(o,σ)→σ( ∃− new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))) ))))) rewrites to ∃− new ρ,τ ( mc(o,ρ)(T ),∃− new σ,τ (mc(o,σ)(@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))), @(G, ⊥c(o,σ)→o( @(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )) ), ⊥c(o,σ)→σ( @(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )) )))) is enough, which can be achieved with the rule ∃− new ρ,c(o,σ)(mc(o,ρ)(T ),@(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )))→ @(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T )) Since its lefthand side is not a rigid pattern, it must be abstracted again by the rule ∃− new ρ,c(o,σ)(mc(o,ρ)(T ), Vc(o,σ)))→ Vc(o,σ) with the abstracting substitution {Vc(o,σ) 7→ @(J,⊥c(o,ρ)→o(T ),⊥c(o,ρ)→ρ(T ))}, and we are done since the new righthand side with the substitution applied coincides with the original one. Hence framed rules are part of the simulating system. Our result allows one to show normal termination of R by checking for higherorder termination of the rules of the rigid system S modulo η. Computing a rigid system S simulating a given non-rigid system R is not always possible, but succeeds often in practice. The way used in the previous examples is ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. A:36 J.-P. Jouannaud and A. Rubio the following: abstract by a fresh free variable the smallest subterm of l containing an outermost versatile subterm, and whose free variables are included in that of l. This defines the abstracting substitution γ. Then, the righthand side is constructed so as to ensure the (stronger than needed) property vγ−→RA r ′ =η r in Definition 8.4. Here is one more example using this transformation strategy: Example 8.9. Let H : α→ β → ρ, x : α and y : β be variables, and R = {f(h1(g(x, y)),@(@(H, h2(g(x, y))), h3(g(x, y))))→ @(@(H, x), y)} which can be abstracted by the three rules {f(h1(g(x, y)), Z1)→ Z1, h2(g(x, y)))→ x, h3(g(x, y))))→ y} Let us now consider a new system with a much bigger rule: f1(m1(f2(m2(T ),@(J, h1(T ), h2(T )))), @(G, h3(f2(m2(T ),@(J, h1(T ), h2(T )))), h4(f2(m2(T ),@(J, h1(T ), h2(T ))))))→ f3(m3(T ), f1(m1(@(J, h1(T ), h2(T ))), @(G, h3(@(J, h1(T ), h2(T ))), h4(@(J, h1(T ), h2(T )))))) which contains the free variables J : α → β → ρ and T : o. The abstraction includes the following additional three rigid rules: {f1(m1(f2(m2(T ), XJ)), XG)→ f3(m3(T ), f1(m1(XJ), XG)), h3(f2(m2(T ), XJ))→ h3(XJ), h4(f2(m2(T ), XJ))→ h4(XJ)} 8.2. From termination modulo η to termination union η-reduction We now turn to η-compatibility. Regarding termination, η-compatibility can easily be replaced by one-side η-compatibility, that is, either s′ =η s t implies s′ t or s t =η t′ implies s t′. This fact is used to show that termination modulo η can be guaranteed by showing termination union η-reduction (after some minor transformation). Therefore, we can apply any technique that ensures termination union η-reduction, which is the case of orderings like HORPO or CPO, in order to show termination modulo η of the original system. As shown below, since the result is proved by working on η-normalized terms, we only have to η-normalize both sides of the rules and add a few rules needed to catch η-reductions that may involve part of the rule and part of the context. For instance if we have a rule @(a, x)→ b in our rewrite system, then λx.@(a, x) can be rewritten into λx.b, but its η-normalization a cannot be rewritten by the η-normalization of @(a, x) → b which is the same rule. We therefore need to extend the set of rules by adding the η-normalization of the rules with all possible contexts which create η-redexes on top, and then η-normalize these rules. Apart from the extra η-normalization phase, ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. Normal Higher-Order Termination A:37 these extensions are similar in spirit to Peterson and Stickel’s notion of associative commutative extension [Peterson and Stickel 1981], and its generalization by Jouannaud and Kirchner [Jouannaud and Kirchner 1986]. Definition 8.10. Let R be a higher-order term rewrite system. Let R↓η = {l↓η→ r↓η| l→ r ∈ R} R = R↓η ∪{ (λxi . . . xn.l)↓η→ (λxi . . . xn.r)↓η| l→ r ∈ R, i ∈ [1..n], l = @(l′, x1, . . . , xn), (∀j 6= k)xj 6= xk, and (∀j)xj / ∈ Var(l′)} For example, if R contains a rule @(a, x, y)→ b then R contains the rules {@(a, x, y) → b, @(a, x) → λy.b, a → λxy.b} THEOREM 8.11. Let R be a higher-order term rewrite system. Then −→(R)η∪β is terminating if −→Rη∪β∪η is terminating. PROOF. We show that s′ =η s−→R t =η t′ implies s′ ↓η −→Rη∪η t′ ↓η and s′ =η s−→β t =η t′ implies s′ ↓η −→β∪η t′ ↓η. By confluence of η, s′ ↓η= s↓η and t↓η= t′ ↓η. We therefore need to show that s−→R t and s−→β t imply s↓η −→Rη∪η t↓η and s↓η −→β∪η t↓η respectively. — Suppose s = s[lσ]p and t = s[rσ]p for some rule l → r in R, substitution σ and position p in s. We proceed by induction on the size of s. — If p = Λ then it holds since, by Property 8 of λ-calculus, we have lσ↓η= l↓η σ↓η and rσ↓η= r↓η σ↓η and l↓η→ r↓η in R. — If s = λxi . . . xn.lσ and l = @(l′, x1, . . . , xn), where n > 0, all xj are different, xj / ∈ Var(l′) and xj / ∈ Dom(σ), there is a rule @(l′, x1, . . . , xi−1)↓η→ λxi . . . xn.r ↓η in R. It follows that s ↓η= @(l′, x1, . . . , xi−1)σ ↓η= @(l′, x1, . . . , xi−1)↓η σ↓η→Rη λxi . . . xn.r↓η σ↓η=s[rσ]↓η. — If s = λx.@(s[lσ]p′ , x) with x / ∈ Var(s[lσ]p′) then s↓η= s[lσ]p′↓η. Further, since rewriting cannot introduce new variables, t = λx.@(s[rσ]p′ , x) with x / ∈ Var(s[rσ]p′), hence t↓η= s[rσ]p′↓η. Induction hypothesis concludes. — Otherwise, if s = λx.s[lσ]p′ then s↓η= λx.(s[lσ]p′↓η), and t = λx.s[rσ]p′ with t ↓η= λx.(s[rσ]p′ ↓η) ↓η, by confluence of η-reduction. Now, by induction hypothesis, we have s[lσ]p′ ↓η −→Rη∪η s[rσ]p′ ↓η, and hence s↓η= λx.(s[lσ]p′↓η)−→Rη∪η λx.(s[rσ]p′↓η)−→η t↓η. — If s = f(s1 . . . s[lσ]p′ . . . sn) then s↓η= f(s1↓η . . . s[lσ]p′↓η . . . sn↓η), and t = f(s1 . . . s [rσ]p′ . . . sn) with t↓η= f(s1↓η . . . s[rσ]p′↓η . . . sn↓η). Now, by induction hypothesis, we have s[lσ]p′↓η −→Rη∪η s[rσ]p′↓η, and hence s↓η= f(s1↓η . . . s[lσ]p′↓η . . . sn↓η)−→Rη∪η f(s1↓η . . . s[rσ]p′↓η . . . sn↓η) = t↓η. — If s = @(s[lσ]p′ , s2) or s = @(s1, s[lσ]p′) it holds as in the previous case. — Suppose s = s[@(λx.u, v)]p and t = s[u{x 7→ v}]p for some position p in s. There are two cases. ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. A:38 J.-P. Jouannaud and A. Rubio — If u = @(u′, x) with x / ∈ Var(u′) then, by confluence of η-reduction, s↓η= s[@(u′, v)]p↓η, and since t = s[@(u′, x){x 7→ v}]p = s[@(u′, v)]p, we have that s↓η= t↓η and thus trivially, s↓η −→β∪η t↓η. — Otherwise s↓η= s[z]p ↓η {z 7→ @(λx.u↓η, v ↓η)}, for a fresh variable z ∈ Var(s[z]p↓η) by property of η. It follows that s↓η −→β s[z]p↓η {z 7→ u↓η {x 7→ v↓η}}. Therefore, by confluence of η-reductions, s↓η −→β∪η t↓η. To conclude, we show that if −→Rη∪β∪η is terminating then there cannot be an infinite sequence with −→(R)η∪β . Assume there is an infinite sequence s0−→(R)η∪β s1−→(R)η∪β . . .. By the previous property, we get an infinite sequence s0↓η −→Rη∪β∪η s1↓η −→Rη∪β∪η . . .. Since β-reduction is terminating there must be infinitely manyR-steps, hence infinitely many (R)η-steps in the original sequence, contradicting our assumption. 8.3. From termination modulo η to plain termination on η-long forms We reduce here termination modulo η to plain termination again, but using this time η-expanded forms. The question was first considered in Kop’s PhD thesis [Kop 2012], Sections 2.2 and 2.3, where it is shown that termination of R modulo η can be ensured by proving termination of some η-expansion ofR, provided the lefthand sides of rules in R are higher-order patterns. Once R is η-expanded, any termination technique for plain higher-order systems can be used. But since η-expansion relies on types, and type instantiation does not preserve η-long forms, these results do not accommodate polymorphism. Kop considers a restricted form of η-expansion where a subterm u is expanded inside its superterm s, denoted s[u] ↪→η s[λx.@(u, x)] if —x : σ is a fresh variable; —u : σ → τ is not (i) a free variable; (ii) an abstraction; (iii) the left argument of an application; (́iv) an application of the form @(y, t1, . . . , tn) where y is free in s and n > 0; (v) any of the ti’s in @(y, t1, . . . , tn) whenever y is free in s. The η-long form of s, denoted by s↑, is the normal form of s with respect to restricted η-expansion. The η-long form of a rewrite system R is the set R↑= { @(l, z1, . . . , zn)↑→ @(r, z1, . . . , zn)↑ : l→ r ∈ R l : τ1 → . . . τn → o, o is a base type and(∀i ≤ n) zi : τi is fresh} Kop proves the following result (2.15(7) in [Kop 2012]): LEMMA 8.12. Let R be a set of rules in η-long form, whose lefthand sides are patterns not headed by λ. Then s−→(R∪β) t implies s↑ −→ + R↑η∪β t↑. We shall now reduce termination modulo η to plain termination via the computation of η-long forms in Kop’s sense, hence allowing us to use Lemma 8.12. A nonACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. Normal Higher-Order Termination A:39 trivial obstacle is that different η-equivalent terms may have different η-long forms. The reason originates in the syntactic restrictions in the definition of η-expansion that ensure termination, when the subterm of arrow type to be expanded is a free variable or the first argument of an application. For an example, @(λx.@(a, x), b) and @(a, b) are different η-equivalent η-long forms (in her sense). In order to avoid the problem with free variables we show termination by proving the absence of infinite sequences of closed terms, as already done in Theorem 3.8. The second problem is more delicate, and that is where we need to introduce a new tool. Let β∩η be a new rewrite system encoding the intersection of β and η reductions via their two critical pairs: @(λx.@(u, x), v) → @(u, v) if x 6∈ Var(u) λx.@(λy.u, x) → λy.u if x 6∈ Var(λy.u) . Clearly, β∩η-reductions is included in βand η-reductions. We now investigate the properties of this rewrite system. LEMMA 8.13 (DIAMOND). The rewrite system β∩η is strongly confluent. PROOF. Using Huet’s characterization of strong confluence for linear systems [Huet 1980], we need to prove that the 4 critical pairs are strongly confluent. (1) First rule with itself. The superposition term is s = @(λx.@(λy.@(u, y), x), v), with x 6∈ Var(λy.@(u, y)) and y 6∈ Var(u). Then s−→@(λx.@(u, x), v) and s−→@(λy.@(u, y), v), both terms rewriting in one step to @(u, v). (2) Second rule with itself. The superposition term is s = λx.@(λy.@(λz.u, y), x), with x, y 6∈ Var(λz.u). Then s−→ λx.@(λz.u, x) and s−→ λy.@(λz.u, y), both terms rewriting in one step to λz.u. (3) Second rule inside the first. The superposition term is s = @(λx.@(λy.u, x), v), with x 6∈ Var(λy.u). Then s rewrites to @(λy.u, v) in both cases. (4) First rule inside the second. The superposition term is s = λx.@(λy.@(u, y), x), with x 6∈ Var(λy.@(u, y)) and y 6∈ Var(u). Then s rewrites to λx.@(u, x) with the first rule and λy.@(u, y) with the second, both terms being equal up to α-renaming. Being confluent and terminating, the rewrite system β∩η enjoys the unique normal form property. We denote by u↓β∩η the normal form of u with respect to β ∩ η. LEMMA 8.14. Let u, v be two terms such that u−→R v, where R is a higherorder rewrite system whose lefthand sides are patterns. Then, u↓β∩η −→R∪β v↓β∩η. PROOF. The proof is by induction on u compared with −→β∩η. Let u p −→ R v. If u = u↓β∩η, we are done. Otherwise, u q −→ β∩η u′. We show by cases on p, q that ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. A:40 J.-P. Jouannaud and A. Rubio u−→R v′ and v−→β∩η v′ for some v′ and conclude by induction hypothesis on u′ and confluence of β ∩ η which ensures that u↓β∩η= u↓β∩η and v↓β∩η= v↓β∩η. (1) If p and q are disjoint, both steps commute as needed. (2) p ≥ q. Since lefthand sides of rules in R are rigid patterns, their lefthand side is not an abstraction nor a β-redex, hence no overlap with β∩η is possible. Therefore, the R-redex is inside the substitution of the other redex, and since β∩η is linear, both steps must commute and the result holds as above. (3) q > p, hence p = q ·m for some position m. This is the difficult case. Assume first that m ∈ Pos(l) and l|m is an application, hence there is an overlap between the R-rule and the first rule in β ∩ η. Then l|mσ = @(λx.@(w1, x), w2). Since lefthand sides of rules in R are β-normal, l|m cannot have an abstraction as first argument of the application, hence it can only be a variable. But this is impossible too by our assumption that l is a rigid pattern. Assume now that m ∈ Pos(l) and l|m is an abstraction, implying an overlap between the R-rule and the second rule in β∩η. Then l|mσ = λx.@(λy.w, x) with x 6∈ Var(λy.u). Higher-order substitutions do not capture variables, hence l|m = λx.@(w′, x), andw′ must be an abstraction or a free variable. Impossible. We are left with the case where no overlap occurs, which holds as before. LEMMA 8.15. Given two terms u, v such that u−→β v then u↓β∩η −→β v↓β∩η. PROOF. Let u p −→ β v, hence u|p = @(λx.s′, t′). The proof is by induction on u. If u = u↓β∩η, we are done. Otherwise, u q −→ β∩η u′ for some term u′ and position q. We show that u−→β v′′ and v−→β∩η v′′ and conclude by induction hypothesis on u′. (1) If the position q is disjoint from p, or at a strict prefix of p without overlapping p, or inside s′, or inside t′, then the same β∩η-rewrite takes place in v (possibly many times in the latter case), yielding the result. (2) If u|q = @(λy.@(λx.s′, y), t), with t′ = y 6∈ Var(λx.s′). Then u′ and v are equal up to variable renaming. (3) If u|q = λy.@(λx.s′, y), that is, t′ = y 6∈ Var(λx.s′). Then u′ and v are equal up to variable renaming again. LEMMA 8.16. Let u, v be β∩η-normal closed terms. If u =η v then u↑=v↑. PROOF. We first prove that if u is closed and normal with respect to β ∩ η and u−→η u′ then u↑= u′↑η. By assumption we have that there is a position p in u such that u|p = λx.@(w, x) with x 6∈ Var(w) and u′ = u[w]p. Moreover, u′ is also closed and normal with respect to β ∩ η. Now, we show that, u′ = u[w] ↪→η u[λx.@(w, x)] = u, which implies that u↑= u′↑η. ACM Journal Name, Vol. V, No. N, Article A, Publication date: January YYYY. Normal Higher-Order Termination A:41 Assume that the step u[w] ↪→η u[λx.@(w, x)] cannot be applied, then, since u′ is closed there are only two possible reasons. — If w is an abstraction of the form λy.s then, we have that u|p = λx.@(λy.s, x), which contradicts the fact that u is normal with respect to β ∩ η. — If w is the left argument of an application then, with q the position just above p, we have that uq = @(λx.@(w, x), w′) for some w′, which again contradicts the fact that u is normal with respect to β ∩ η. To conclude, from u−→η u′ implies u ↑= u′ ↑, since u′ is also closed and normal with respect to β ∩ η, we have by easy induction that u↑= u↓η↑, for every closed term and normal with respect to β ∩ η. Therefore, we have u↑= u↓η↑ and v↑= v↓η↑, and s↓η= v↓η, since u =η v, and we conclude. We are now ready for the main result of this section: THEOREM 8.17. Let R be a higher-order term rewrite system, where all lefthand sides are rigid patterns. Then −→(R)η∪β is terminating if −→R↑η∪β is terminating on terms in η-long form. PROOF. Let s and t be two closed terms. First we show that if s−→(R)η t then s↓β∩η↑ −→R↑η∪β t↓β∩η↑. By definition, s =η s−→R t′ =η t and, by Lemma 8.14, s↓β∩η −→R∪β t↓β∩η. This implies that s↓β∩η=η s↓β∩η −→R∪β t↓β∩η=η t↓β∩η, and by Lemma 8.12 and 8.16, s↓β∩η↑= s↓β∩η↑ −→+(R↑η∪β) t↓β∩η↑= t↓β∩η↑. Similarly, by Lemma 8.15 first and then Lemma 8.12, we conclude that s−→β t implies s↓β∩η↑ −→R↑η∪β t↓β∩η↑. We now show the absence of infinite sequences of closed terms. Let s0−→(R)η∪β s1−→(R)η∪β . . . be one. Since β alone is terminating, there must be infinitely manyR-steps. By the previous two properties, we get an infinite sequence si0↓β∩η↑ −→+(R↑η∪β) si1↓β∩η↑ −→ + (R↑η∪β) . . . with j ≤ ij < ij+1 for all j, contradicting the termination assumption of −→R↑η∪β on terms in η-long form. The method based on η-expansions has indeed several drawbacks: termination proof methods are better suited to η-reductions than η-expansions, which introduces abstractions; it requires lefthand sides of rules to be rigid patterns, a property which may not be compatible with other transformation methods and, moreover, it is not compatible with polymorphism. Despite the fact that η-long normal forms are often used in the implementations we are aware of, we believe that this method has less potential than the one based on η-reductions.
منابع مشابه
Higher-Order Orderings for Normal Rewriting
We extend the termination proof methods based on reduction orderings to higher-order rewriting systems using higher-order pattern matching, and accomodate for any use of eta, as a reduction, as an expansion or as an equation.
متن کاملUnique Normal Form Property of Higher-Order Rewriting Systems
Within the framework of Higher-Order Rewriting Systems proposed by van Oostrom, a su cient condition for the unique normal form property is presented. This requires neither left-linearity nor termination of the system.
متن کاملProving and Disproving Termination of Higher-Order Functions
The dependency pair technique is a powerful modular method for automated termination proofs of term rewrite systems (TRSs). We present two important extensions of this technique: First, we show how to prove termination of higher-order functions using dependency pairs. To this end, the dependency pair technique is extended to handle (untyped) applicative TRSs. Second, we introduce a method to pr...
متن کاملOn Dependency Pair Method for Proving Termination of Higher-Order Rewrite Systems
This paper explores how to extend the dependency pair technique for proving termination of higher-order rewrite systems. In the first order case, the termination of term rewriting systems are proved by showing the non-existence of an infinite R-chain of the dependency pairs. However, the termination and the non-existence of an infinite R-chain do not coincide in the higher-order case. We introd...
متن کاملTermination in Higher-Order Concurrent Calculi
We study termination of programs in concurrent higherorder languages. A higher-order concurrent calculus combines features of the λ-calculus and of the message-passing concurrent calculi. However, in contrast with the λ-calculus, a simply-typed discipline need not guarantee termination; and, in contrast with message-passing calculi such as the π-calculus, divergence can be obtained even without...
متن کاملProving Termination of Unfolding Graph Rewriting for General Safe Recursion
In this paper we present a new termination proof and complexity analysis of unfolding graph rewriting which is a specific kind of infinite graph rewriting expressing the general form of safe recursion. We introduce a termination order over sequences of terms together with an interpretation of term graphs into sequences of terms. Unfolding graph rewrite rules expressing general safe recursion ca...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2015